<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta http-equiv="X-UA-Compatible" content="ie=edge" />
	<link rel="stylesheet" type="text/css" href="css/index.css"/>
	<title>注册</title>
	<style type="text/css">
		html,body{
			width: 100%;
			height: 100%;
		}
	</style>
</head>
<body>
	<div class="login">
		<div class="loginbox">
			<div class="loginbox1">
				<div class="logintitle">商城用户注册</div>
				<div class="loginform">
					<div class="user"><p class="logpic"><img src="img/user.png" alt="" class="loginicon" /></p><input id="telphone" type="text" placeholder="请输入用户名" class="logginpt" /></div>
					<div class="user"><p class="logpic"><img src="img/mima.png" alt="" class="loginicon" /></p><input id="password" type="password" placeholder="请输入密码" class="logginpt" /></div>
					<div class="btn">
						<div id="register" class="btn3" onclick="">注册</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
<script src="js/Global.js"></script>
<script src="js/jquery-1.11.0.js"></script>
		<script type="application/javascript">
			jQuery(document).ready(function(){
				//绑定otp的click时间用于向后段发送获取手机验证码请求。
				$("#register").on("click",function(){
					var telphone = $("#telphone").val();
					console.log(requesturl+"user/register");
					var url = requesturl+"user/register";
					$.ajax({
						type:"post",
						url:requesturl+"user/register",
						async:false,
						data:{
							"telphone":$("#telphone").val(),
							"password":$("#password").val()
						},
						xhrFields:{withCredentials:true},
						success:function(data){
							if(data.status=="success"){
								alert("恭喜，注册成功");
								window.location.href="./login.html";
							}else{
								alert("注册失败："+data.data.errMsg);
							}
						},
						error:function(data){
							alert("网络原因发送失败："+data.responseText);
						}					
					});
				});
			});
		</script>